package com.fjl.filter;

import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class MyFilterConfig {

    @Bean
    public FilterRegistrationBean<MethodFilter> disableTraceFilter() {
        FilterRegistrationBean<MethodFilter> registrationBean = new FilterRegistrationBean<>();
        registrationBean.setFilter(new MethodFilter());
        registrationBean.addUrlPatterns("/*");
        return registrationBean;
    }
    @Bean
    public FilterRegistrationBean<AbpmFilter> loggingFilter() {
        FilterRegistrationBean<AbpmFilter> registrationBean = new FilterRegistrationBean<>();
        registrationBean.setFilter(new AbpmFilter());
        registrationBean.addUrlPatterns("/*"); // 设置过滤器的URL模式
        registrationBean.setOrder(1); // 设置过滤器执行顺序，数字越小越先执行
        return registrationBean;
    }
}